#------------------------------------------------------------------------------
# Copyright (C)2019 Robert Cowart
#
# The contents of this file and/or repository are subject to the Robert Cowart
# Public License (the "License") and may not be used or distributed except in
# compliance with the License. You may obtain a copy of the License at:
#
# http://www.koiossian.com/public/robert_cowart_public_license.txt
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
# the specific language governing rights and limitations under the License.
#
# The Original Source Code was developed by Robert Cowart. Portions created by
# Robert Cowart are Copyright (C)2019 Robert Cowart. All Rights Reserved.
#------------------------------------------------------------------------------

output {
  elasticsearch {
    id => "output_elasticsearch_single"
    hosts => [ "${ELASTIFLOW_ES_HOST:127.0.0.1:9200}" ]
    ssl => "{{ ssl_enabled | lower }}"
    ssl_certificate_verification => "{{ ssl_verify | lower }}"
    # If ssl_certificate_verification is true, uncomment cacert and set the path to the certificate.
    #cacert => "/PATH/TO/CERT"
    {% if es_username is defined -%}
    user => "${ELASTIFLOW_ES_USER:elastic}"
    password => "${ELASTIFLOW_ES_PASSWD:changeme}"
    {% endif -%}
    index => "elastiflow-{{ ef_ver | replace('v', '') }}-%{+YYYY.MM.dd}"
    template => "${ELASTIFLOW_TEMPLATE_PATH:{{ logstash_etc }}/elastiflow/templates}/elastiflow.template.json"
    template_name => "elastiflow-{{ ef_ver | replace('v', '') }}"
    template_overwrite => "true"
  }
}
